import request from '@/config/axios'

// 商家和小程序用户关联 VO
export interface MerchantUserVO {
  id: number // 主键ID
  merchantId: number // 商家ID
  userId: number // 小程序用户ID
  relationType: number // 关联类型
  status: number // 状态
}

// 商家和小程序用户关联 API
export const MerchantUserApi = {
  // 查询商家和小程序用户关联分页
  getMerchantUserPage: async (params: any) => {
    return await request.get({ url: `/juliang/merchant-user/page`, params })
  },

  // 查询商家和小程序用户关联详情
  getMerchantUserById: async (id: number) => {
    return await request.get({ url: `/juliang/merchant-user/getById?id=` + id })
  },

  // 新增商家和小程序用户关联
  createMerchantUser: async (data: MerchantUserVO) => {
    return await request.post({ url: `/juliang/merchant-user/create`, data })
  },

  // 修改商家和小程序用户关联
  updateMerchantUser: async (data: MerchantUserVO) => {
    return await request.post({ url: `/juliang/merchant-user/update`, data })
  },

  // 修改商家和小程序用户关联状态
  updateMerchantUserStatus: async (id: number, status: number) => {
    const data = {
      id,
      status
    }
    return await request.post({ url: `/juliang/merchant-user/updateStatus`, data: data })
  },

  // 删除商家和小程序用户关联
  deleteMerchantUserById: async (id: number) => {
    return await request.get({ url: `/juliang/merchant-user/delete?id=` + id })
  },

  // 导出商家和小程序用户关联 Excel
  exportMerchantUser: async (params) => {
    return await request.download({ url: `/juliang/merchant-user/export-excel`, params })
  },
}
